package com.appwoo.txtws.activity;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnKeyListener;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import com.appwoo.txtws.bean.Contact;
import com.appwoo.txtws.bean.ListHeightUtils;
import com.appwoo.txtws.bean.ServerAppBean;
import com.appwoo.txtws.component.Logger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class HoldUpActivity extends Activity
  implements View.OnClickListener
{
  private List<Contact> contactList;
  private List<Contact> contactList1 = new ArrayList();
  TextView contact_back_tv;
  Dialog dialog;
  private ListView listView;
  ListView listView_emerlb;
  View.OnClickListener mOkOnClqd = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      Intent localIntent = new Intent("android.intent.action.CALL", Uri.parse("tel:" + HoldUpActivity.this.number));
      HoldUpActivity.this.startActivity(localIntent);
      HoldUpActivity.this.dialog.dismiss();
      com.appwoo.txtws.component.Global.holdup = true;
    }
  };
  View.OnClickListener mOkOnClqx = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      HoldUpActivity.this.dialog.dismiss();
    }
  };
  private String number;
  ServerAppBean serverAppBean;

  private void dialogqd(View paramView)
  {
    Button localButton = (Button)paramView.findViewById(2131493105);
    ((TextView)paramView.findViewById(2131493104)).setText(getString(2131427617) + this.number + " ?");
    localButton.setOnClickListener(this.mOkOnClqd);
  }

  private void dialogqx(View paramView)
  {
    ((Button)paramView.findViewById(2131493106)).setOnClickListener(this.mOkOnClqx);
  }

  private List<Map<String, Object>> getData()
  {
    ArrayList localArrayList = new ArrayList();
    for (int i = 0; ; i++)
    {
      if (i >= this.contactList.size())
        return localArrayList;
      HashMap localHashMap = new HashMap();
      localHashMap.put("contact", ((Contact)this.contactList.get(i)).getContact());
      localHashMap.put("date", ((Contact)this.contactList.get(i)).getDate());
      localArrayList.add(localHashMap);
    }
  }

  public void onBackPressed()
  {
    this.serverAppBean.contaList = this.contactList1;
    Intent localIntent = new Intent("android.intent.action.MAIN");
    localIntent.addCategory("android.intent.category.HOME");
    localIntent.setFlags(268435456);
    startActivity(localIntent);
    finish();
    com.appwoo.txtws.component.Global.holdup = false;
  }

  public void onClick(View paramView)
  {
    if (paramView.getId() == 2131493039)
    {
      this.serverAppBean.contaList = this.contactList1;
      Intent localIntent = new Intent("android.intent.action.MAIN");
      localIntent.addCategory("android.intent.category.HOME");
      localIntent.setFlags(268435456);
      startActivity(localIntent);
      finish();
      com.appwoo.txtws.component.Global.holdup = false;
    }
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903073);
    this.contact_back_tv = ((TextView)findViewById(2131493039));
    this.contact_back_tv.setOnClickListener(this);
    this.listView_emerlb = ((ListView)findViewById(2131493040));
    this.serverAppBean = ((ServerAppBean)getApplication());
    this.contactList = this.serverAppBean.contaList;
    MySimpleAdapter localMySimpleAdapter = new MySimpleAdapter(this, getData(), 2130903074, new String[] { "contact", "date" }, new int[] { 2131493041, 2131493042 });
    this.listView_emerlb.setAdapter(localMySimpleAdapter);
    ListHeightUtils.setListViewHeightBasedOnChildren(this.listView_emerlb);
  }

  public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    if (paramInt == 3)
    {
      this.serverAppBean.contaList = this.contactList1;
      finish();
      com.appwoo.txtws.component.Global.holdup = false;
      return false;
    }
    return super.onKeyDown(paramInt, paramKeyEvent);
  }

  protected void onPause()
  {
    super.onPause();
  }

  protected void onResume()
  {
    sendBroadcast(new Intent("closeScreenActivity"));
    super.onResume();
  }

  private class MySimpleAdapter extends SimpleAdapter
  {
    private final Context context;
    private List<Map<String, Object>> data;
    private String[] from;
    private int resource;
    private int[] to;

    public MySimpleAdapter(List<? extends Map<String, ?>> paramInt, int paramArrayOfString, String[] paramArrayOfInt, int[] arg5)
    {
      super(paramArrayOfString, paramArrayOfInt, arrayOfString, arrayOfInt);
      this.context = paramInt;
      this.data = paramArrayOfString;
      this.resource = paramArrayOfInt;
      this.from = arrayOfString;
      this.to = arrayOfInt;
    }

    public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
    {
      View localView = HoldUpActivity.this.getLayoutInflater().inflate(this.resource, null, true);
      Map localMap = (Map)this.data.get(paramInt);
      final TextView[] arrayOfTextView = new TextView[this.from.length];
      for (int i = 0; ; i++)
      {
        if (i >= this.from.length)
        {
          ((TextView)localView.findViewById(2131493043)).setOnClickListener(new View.OnClickListener()
          {
            public void onClick(View paramAnonymousView)
            {
              HoldUpActivity.this.number = arrayOfTextView[0].getText().toString();
              if (HoldUpActivity.this.number.split("\n").length > 1)
                HoldUpActivity.this.number = HoldUpActivity.this.number.split("\n")[1];
              View localView = LayoutInflater.from(HoldUpActivity.this).inflate(2130903099, null);
              HoldUpActivity.this.dialog = new Dialog(HoldUpActivity.this, 2131361810);
              HoldUpActivity.this.dialog.setContentView(localView);
              HoldUpActivity.this.dialogqd(localView);
              HoldUpActivity.this.dialogqx(localView);
              HoldUpActivity.this.dialog.setOnKeyListener(new DialogInterface.OnKeyListener()
              {
                public boolean onKey(DialogInterface paramAnonymous2DialogInterface, int paramAnonymous2Int, KeyEvent paramAnonymous2KeyEvent)
                {
                  if (paramAnonymous2Int == 25)
                  {
                    Logger.e("tag", "VOLUME_DOWN KEY");
                    return true;
                  }
                  if (paramAnonymous2Int == 24)
                  {
                    Logger.e("tag", "VOLUME_UP KEY");
                    return true;
                  }
                  if (3 == paramAnonymous2Int)
                  {
                    Logger.e("tag", "Home");
                    return true;
                  }
                  return false;
                }
              });
              HoldUpActivity.this.dialog.show();
            }
          });
          return localView;
        }
        arrayOfTextView[i] = ((TextView)localView.findViewById(this.to[i]));
        arrayOfTextView[i].setText(localMap.get(this.from[i]));
      }
    }
  }
}

/* Location:           C:\Documents and Settings\Administrator\classes_dex2jar.jar
 * Qualified Name:     com.appwoo.txtws.activity.HoldUpActivity
 * JD-Core Version:    0.6.2
 */